<template>
  <div class="back">
    <div class="backs">
      <el-row>
        <el-col :span="3">
          <div class="font">审批流水</div>
        </el-col>
        <el-col :span="14" :push="8" v-if="cucheckVo.apprComplete == 0" style="margin-top: 10px">
          <el-button type="success" @click="dialogFormVisible = true" :disabled="disabledOne">同意，并结束审批</el-button>
          <el-button type="primary" @click="dialogForm = true" :disabled="disabledTwo">同意，并继续下一个审批人</el-button>
          <el-button type="warning" @click="dialogFormVisible = true">否决，并结束审批</el-button>
        </el-col>
      </el-row>
      <!-- 处理弹框-->
      <el-dialog title="审批" :visible.sync="dialogFormVisible" width="55%">
        <hr class="border-t-a"/>
        <el-form label-width="100px">
          <el-form-item label="审批意见：">
            <el-input type="textarea" style="width: 560px" v-model="apprViews" :rows="2"></el-input>
          </el-form-item>
        </el-form>
        <el-button type="success" @click="updateCheck" style="margin-left: 60px" :disabled="disabledOne">同意，并结束审批</el-button>
        <el-button type="primary" @click="updateTwo" :disabled="disabledTwo">同意，并继续下一个审批人</el-button>
        <el-button type="warning" @click="deleteFalse">否决，并结束审批</el-button>
        <el-button @click="dialogFormVisible = false">取消</el-button>
      </el-dialog>
      <!-- 选择审批人 -->
      <el-dialog title="同意，并继续下一个审批人" :visible.sync="dialogForm" width="55%">
        <hr class="border-t-a"/>
        <el-form label-width="100px">
          <el-form-item label="审批意见：">
            <el-input type="textarea" v-model="apprViews" :rows="2"></el-input>
          </el-form-item>
          <el-form-item label="提交审批给：">
            <el-cascader v-model="employeesId" :options="empList" style="width: 610px"
                         :props="{value:'employeesId',children:'children', label: 'empName',expandTrigger: 'hover' }"
                         @change="empChange" :show-all-levels="false"></el-cascader>
          </el-form-item>
        </el-form>
        <el-row>
          <el-col span="2" :push="18">
            <el-button type="primary" @click="define">确定</el-button>
          </el-col>
          <el-col span="2" :push="19">
            <el-button @click="dialogForm = false">取消</el-button>
          </el-col>
        </el-row>
      </el-dialog>
      <hr class="hrst"/>
      <el-form label-position="right" :model="cucheckVo" label-width="120">
        <el-row>
          <el-col :span="12" :push="3">
            <el-form-item label="申请人：">
              <span>{{cucheckVo.apply}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="创建日期：">
              <span>{{cucheckVo.apprDate | formatDate}}</span>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12" :push="2">
            <el-form-item label="当前审批人：" style="margin-left: 21px">
              <span>{{cucheckVo.approved}}</span>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="状态：" style="margin-left: 26px">
              <span v-if="cucheckVo.cutName">{{cucheckVo.cutName}}</span>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <el-row>
        <el-col :span="4" :push="2">
          <span style="margin-left: 18px">审批相关数据：</span>
        </el-col>
        <!-- 销售费用 -->
        <el-col :span="17" style="margin-left: 20px">
          <div class="borders">
            <el-form label-position="left" :model="expenseVo" v-show="expsForm" label-width="80" style="margin-left: 80px;margin-top: 20px">
              <el-row>
                <el-col :span="12">
                  <el-form-item label="金额">
                    {{expenseVo.expsMoney}}
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="票据张数">
                    {{expenseVo.expsNote}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="费用类别">
                    {{expenseVo.expsSort}}
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="日期">
                    {{expenseVo.expsDate | formatDate}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-form-item label="用途">
                {{expenseVo.expsPurpose}}
              </el-form-item>
              <el-form-item label="客户">
                {{expenseVo.customerByCustomId.cusName}}
              </el-form-item>
              <el-form-item label="备注">
                {{expenseVo.expsRemark}}
              </el-form-item>
              <el-row>
                <el-col>
                  <el-form-item label="审批人">
                    {{expenseVo.approved}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="经手人">
                    {{expenseVo.apply}}
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="审批状态">
                    {{expenseVo.cutName}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="人数">
                    {{expenseVo.expsNumber}}
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="发票类别">
                    {{expenseVo.expsGenre}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="发票税率">
                    {{expenseVo.expsRate}}
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="报销">
                    {{expenseVo.expsRefus | formatState}}
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
            <!-- 出差申请 -->
            <el-form label-position="right" :model="evection" v-show="evetForm" label-width="80px" style="margin-left: 30px;margin-top: 20px">
              <el-row>
                <el-col :span="19" :push="2">
                  <el-form-item label="主题">
                    {{evection.evetSubject}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12" :push="2">
                  <el-form-item label="开始日期">
                    {{evection.evetDate | formatDate}}
                  </el-form-item>
                </el-col>
                <el-col :span="12" :push="1">
                  <el-form-item label="结束时间">
                    {{evection.evetData | formatDate}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="19" :push="2">
                  <el-form-item label="出发地">
                    {{evection.evetDepart}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="19" :push="2">
                  <el-form-item label="目的地">
                    {{evection.evetGoal}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="19" :push="2">
                  <el-form-item label="交通工具">
                    {{evection.evetTraffic}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="19" :push="2">
                  <el-form-item label="客户">
                    {{evection.customerByCustomId.cusName}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8" :push="2">
                  <el-form-item label="申请人">
                    {{evection.empByEmployeesId.empName}}
                  </el-form-item>
                </el-col>
                <el-col :span="8" :push="5">
                  <el-form-item label="审批状态">
                    {{evection.evetStatus}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8" :push="2">
                  <el-form-item label="经费">
                    {{evection.evetLoan}}
                  </el-form-item>
                </el-col>
                <el-col :span="8" :push="5">
                  <el-form-item label="状态">
                    {{evection.evetState}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="19" :push="2">
                  <el-form-item label="备注">
                    {{evection.evetRemark}}
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
            <!--报价审批-->
            <el-form label-width="100px" :model="offerOne" v-show="offerFrom" style="margin-top: 20px">
              <el-row>
                <el-col>
                  <el-form-item label="报价主题:"  >
                    {{offerOne.offerTitle}}
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="报价单号:"  >
                    {{offerOne.offerNumber}}
                  </el-form-item>
                </el-col>
                <el-col :span="11">
                  <el-form-item label="客户名称:">
                    {{offerOne.customerByCustomId.cusName}}
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="对应商机:" >
                    {{offerOne.businessInfoByBusinesId.businessName}}
                  </el-form-item>
                </el-col>
                <el-col :span="11">
                  <el-form-item label="报价人:">
                    {{offerOne.offerEmp.empName}}
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="产品报价:" >
                    {{offerOne.productOffer}}
                  </el-form-item>
                </el-col>
                <el-col :span="11">
                  <el-form-item label="预估毛利:">
                    {{offerOne.profit}}
                  </el-form-item>
                </el-col>
                <el-col :span="11">
                  <el-form-item  label="审核状态:">
                    <span v-if="offerOne.offerStatus==1">提交</span>
                    <span v-if="offerOne.offerStatus==2">待审批</span>
                    <span v-if="offerOne.offerStatus==3">审批中</span>
                    <span v-if="offerOne.offerStatus==4">同意</span>
                    <span v-if="offerOne.offerStatus==5">否决</span>
                  </el-form-item>
                </el-col>
                <el-col :span="11">
                  <el-form-item  label="接收人:">
                    {{propleName}}
                  </el-form-item>
                </el-col>
                <el-col :span="24">
                  <el-form-item label="付款说明:" >
                    {{offerOne.paymentInstructions}}
                  </el-form-item>
                </el-col>
                <el-col :span="24">
                  <el-form-item label="运输说明:" >
                    {{offerOne.transportInstructionsstyle}}
                  </el-form-item>
                </el-col>
                <el-col :span="24">
                  <el-form-item label="报价备注:" >
                    {{offerOne.offerRemarks}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row style="margin-left: 20px;margin-bottom: 20px">
                <el-col>
                  <el-table :data="offerTwo" :header-cell-style="{background:'#eef1f6',color:'#606266'}"
                            style="width: 97%;margin-top: 10px;">
                    <el-table-column  prop="productside.zproductByProductId.productName"  label="产品名称" ></el-table-column>
                    <el-table-column  prop="productside.zproductByProductId.prModel"   label="型号"  ></el-table-column>
                    <el-table-column  prop="prsPrice" label="价格"></el-table-column>
                    <el-table-column label="折扣%" prop="prsDiscount"></el-table-column>
                    <el-table-column label="折后价" prop="prsDiscountedPrice"></el-table-column>
                    <el-table-column  label="数量" prop="prsNum" ></el-table-column>
                    <el-table-column label="单位"  prop="productside.psUnit"></el-table-column>
                    <el-table-column label="小计"  prop="prsCount"></el-table-column>
                  </el-table>
                </el-col>
              </el-row>
            </el-form>
            <!-- 合同审批 -->
            <el-form label-width="80px" :model="zhaoContractInfo" v-show="contractShow" style="margin-left: 80px;margin-top: 20px">
              <el-row>
                <el-col :span="11">
                  <el-form-item label="主题">
                    {{zhaoContractInfo.contractTheme}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="对应客户" v-if="zhaoContractInfo.cusName">
                    {{contractList.customerByCustomId.cusName}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="11">
                  <el-form-item label="对应机会">
                    {{zhaoContractInfo.businessName}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="合同编号">
                    {{zhaoContractInfo.contractName}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="11">
                  <el-form-item label="生效时间">
                    {{zhaoContractInfo.effectTime}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="失效时间">
                    {{zhaoContractInfo.failureTime}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="11">
                  <el-form-item label="签约人">
                    {{zhaoContractInfo.customerName}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="所有者">
                    {{zhaoContractInfo.empName}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="11">
                  <el-form-item label="签约时间">
                    {{zhaoContractInfo.signingTime | formatDates}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="总金额">
                    {{zhaoContractInfo.totalAmount}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="11">
                  <el-form-item label="付款方式">
                    {{zhaoContractInfo.termsName}}
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="状态">
                    {{zhaoContractInfo.contractState | formatData}}
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-form-item label="备注">
                  {{zhaoContractInfo.noteInfo}}
                </el-form-item>
              </el-row>
            </el-form>
            <div class="delete_height" v-show="deleteShow">
              <div style="margin-left: 10px;margin-top: 15px">业务数据已经被删除</div>
            </div>
          </div>
        </el-col>
      </el-row>
      <el-row style="margin-top: 40px">
        <el-col :span="3" :push="3">
          <span>审批操作:</span>
        </el-col>
        <el-col :span="10" :push="1" style="margin-left: 20px">
          <el-timeline :reverse="false">
            <el-timeline-item
              v-for="(activity, index) in checkDetailsList"
              :key="index">
              {{activity.apprsDate | formatDates}} {{activity.empByEmployeesId.empName}} {{activity.cucheckTypeByCutId.cutName}}
            </el-timeline-item>
          </el-timeline>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'AsAddCheck',
    data: function () {
      return {
        cucheckVo:{
          apprId: '',
          apprIds: '',
          apprTitle: '',
          apprReason: '',
          apprView: '',
          apprDate: '',
          apprComplete: '',
          apprDelete: '',
          cutId: '',
          approved: '',
          apply: '',
          cutName: '',
        },//审批表
        expenseVo: {
          expsId:'',
          expsRefus:'',
          expsDate:'',
          expsMoney:'',
          expsSort:'',
          expsNote:'',
          expsPurpose:'',
          expsRemark:'',
          expsNumber:'',
          expsGenre:'',
          expsRate:'',
          expsDelete:'',
          empId:'',
          approved:'',
          apply:'',
          cutName:'',
          customerByCustomId:{
            customId:'',
            cusName:''
          }
        },//销售费用表
        evection:{
          evetId:'',
          evetDate:'',
          evetData:'',
          evetEmpid:'',
          evetDepart:'',
          evetGoal:'',
          evetSubject:'',
          evetTraffic:'',
          evetRemark:'',
          evetState:'',
          evetLoan:'',
          evetStatus: '',
          evetDelete: '',
          customerByCustomId:{
            customId:'',
            cusName:''
          },
          empByEmployeesId:{
            employeesId:'',
            empName:''
          }
        },//出差表
        propleName:'',
        offerOne:{
          offer_id2:0,
          offerTitle:'',
          offerNumber:'',
          productOffer:'',
          paymentInstructions:'',
          transportInstructions:'',
          offerStatus:'',
          offerRemarks:'',
          profit:'',
          offerEmp:{
            empName:''
          },
          customerByCustomId:{
            cusName:''
          },
          businessInfoByBusinesId:{
            businessName:'',
            culinkmanByCupId:{
              cupName:''
            }
          }
        },//报价表
        title:'',//审批类型
        apprIds: '',      //需审批的id
        apprViews: '',     //审批意见
        empList:[],       //员工列表
        employeesId:'',   //当前审批人
        user: {},         //当前登录用户信息
        empId:'',         //员工id
        dialogFormVisible: false,  //处理弹框
        dialogForm: false,
        disabledOne: false,
        disabledTwo: false,
        offerTwo:[],    //报价产品信息列表
        contractList:{
        },    //合同信息
        zhaoContractInfo:{
          contractState:'',
          signingTime:'',
          contractTheme:'',
          businessName:'',
          contractName:'',
          effectTime:'',
          failureTime:'',
          totalAmount:'',
          customerName:'',
          empName:'',
          termsName:'',
          cusName:'',
          noteInfo:''
        },
        checkDetailsList:[],//审批记录列表
        expsForm:false,     //销售费用显隐
        evetForm:false,     //出差表显隐
        offerFrom:false,    //报价表显隐
        contractShow:false, //合同表显隐
        deleteShow:false    //删除显隐
      }
    },
    created: function () {
      this.user = JSON.parse(sessionStorage.getItem('user'));
      this.empId = this.user.employeesId;//当前登录用户id
      this.init();

      this.$axios.get("http://localhost:8088/exs/check-emp"
      ).then(v=>{
        this.empList = v.data;
      }).catch(v=>{
        alert("访问失败!"+v.data);
      })
    },
    methods: {
      init(){//数据回显
        var apprId = this.$route.query.apprId;
        if(apprId != undefined && apprId != '') {
          this.$axios.get("http://localhost:8088/che/query-check",
            {params: {apprId: apprId}}
          ).then(v => {//审批表
            this.cucheckVo = v.data;
            if(this.cucheckVo.apprDelete == 0){
              this.disabledOne = true;
              this.disabledTwo = true;
            }
            if(this.cucheckVo.apprDelete == 1){
              this.disabledOne = false;
              this.disabledTwo = false;
            }
          }).catch(v => {
            alert("访问失败!" + v.data);
          })

          this.$axios.get("http://localhost:8088/che/check-title",
            {params: {apprId: apprId}}
          ).then(v => {
            this.title = v.data;
            if (this.title != null && this.title != undefined && this.title != ''){
              if (this.title == "费用报销") {
                this.$axios.get("http://localhost:8088/che/exps-check",
                  {params: {apprId: apprId}}
                ).then(v => {
                  this.expenseVo = v.data;
                  if(this.expenseVo.expsDelete == 0){
                    this.deleteShow = true;
                    this.expsForm = false;
                    this.evetForm = false;
                    this.offerFrom = false;
                    this.contractShow = false;
                  }
                  if(this.expenseVo.expsDelete == 1){
                    this.expsForm = true;
                    this.evetForm = false;
                    this.offerFrom = false;
                    this.contractShow = false;
                    this.deleteShow = false;
                  }
                }).catch(v => {
                  alert("访问失败!" + v.data);
                })
              }
              if (this.title == "出差申请") {
                this.$axios.get("http://localhost:8088/che/evet-check",
                  {params: {apprId: apprId}}
                ).then(v => {
                  this.evection = v.data;
                  if(this.evection.evetDelete == 0){
                    this.deleteShow = true;
                    this.expsForm = false;
                    this.evetForm = false;
                    this.offerFrom = false;
                    this.contractShow = false;
                  }
                  if(this.evection.evetDelete == 1){
                    this.evetForm = true;
                    this.deleteShow = false;
                    this.expsForm = false;
                    this.offerFrom = false;
                    this.contractShow = false;
                  }
                }).catch(v => {
                  alert("访问失败!" + v.data);
                })
              }
              if(this.title == "报价审批"){
                this.evetForm = false;
                this.expsForm = false;
                this.offerFrom = true;
                this.contractShow = false;
                this.deleteShow = false;
                this.$axios.get("http://localhost:8088/che/appr-ids",
                  {params:{apprId: apprId}}
                ).then(v => {
                  this.apprIds = v.data;
                  this.$axios.get("http://localhost:8088/buDetailsTwo/offerOne",
                    {params:{offerId:this.apprIds}}).then(v=>{
                    this.offerOne=v.data;
                    this.propleName=v.data.businessInfoByBusinesId.culinkmanByCupId.cupName;
                  }).catch();

                  this.$axios.get("http://localhost:8088/buDetailsTwo/offerTwo",
                    {params:{offerId:this.apprIds}}
                  ).then(v => {//报价产品信息
                    this.offerTwo = v.data;
                  }).catch(v => {
                    alert("访问失败!" + v.data);
                  })
                }).catch(v => {
                  alert("访问失败!" + v.data);
                })
              }
              if(this.title == "合同审批"){
                this.evetForm = false;
                this.expsForm = false;
                this.offerFrom = false;
                this.contractShow = true;
                this.deleteShow = false;
                this.$axios.get("http://localhost:8088/che/appr-ids",
                  {params:{apprId: apprId}}
                ).then(v => {
                  this.apprIds = v.data;
                  this.$axios.get("http://localhost:8088/contract_Details",
                    {params:{contractid:this.apprIds}}
                  ).then(v=>{
                    this.contractList = v.data;
                    this.zhaoContractInfo.contractState = v.data.contractState;
                    this.zhaoContractInfo.signingTime = v.data.signingTime;
                    this.zhaoContractInfo.cuName = v.data.customerByCustomId.cusName;
                    this.zhaoContractInfo.contractName = v.data.contractName;
                    this.zhaoContractInfo.contractTheme = v.data.contractTheme;
                    this.zhaoContractInfo.termsName = v.data.termsPayment.termsName;
                    this.zhaoContractInfo.businessName = v.data.businessInfoByBusinesId.businessName;
                    this.zhaoContractInfo.effectTime = v.data.effectTime;
                    this.zhaoContractInfo.failureTime = v.data.failureTime;
                    this.zhaoContractInfo.totalAmount = v.data.totalAmount;
                    this.zhaoContractInfo.customerName = v.data.customerName;
                    this.zhaoContractInfo.empName = v.data.empId8.empName;
                    this.zhaoContractInfo.cusName = v.data.customerByCustomId.cusName;
                    this.zhaoContractInfo.noteInfo = v.data.noteInfo;
                  }).catch(v => {
                    alert("访问失败!" + v.data);
                  })
                }).catch(v => {
                  alert("访问失败!" + v.data);
                })
              }
            }
          }).catch(v => {
            alert("访问失败!" + v.data);
          })

          this.$axios.get("http://localhost:8088/che/check-details",
            {params: {apprId: apprId}}
          ).then(v=>{//审批记录表
            this.checkDetailsList = v.data;
          }).catch(v=>{
            alert("访问失败!"+v.data);
          })
        }
      },
      empChange(item) {//获取员工id
        if (this.employeesId != '') {
          this.employeesId = item[1];
        } else {
          this.employeesId = 0;
        }
      },
      updateCheck(){//同意
        if(this.empId != undefined && this.empId != '') {
          this.$axios.get("http://localhost:8088/che/update-check", {
            params: {
              empId: this.empId,
              apprId: this.cucheckVo.apprId,
              apprView: this.apprViews,
              trialId: this.cucheckVo.apprIds,
              title: this.cucheckVo.apprTitle
            }
          }).then(v => {
            this.dialogFormVisible = false;
            this.init();
          }).catch(v => {
            alert("访问失败!" + v.data);
          })
        }
      },
      updateTwo(){
        this.dialogFormVisible = false;
        this.dialogForm = true;
      },
      define(){//移至下一个审批人
        if(this.employeesId == '' || this.employeesId == undefined){
          this.$message.error("必须选择审批人");
        }else {
          if(this.empId != undefined && this.empId != '') {
            this.$axios.get("http://localhost:8088/che/deliver-check", {
              params: {
                empId: this.empId,
                apprId: this.cucheckVo.apprId,
                employeesId: this.employeesId,
                apprView: this.apprViews,
                trialId: this.cucheckVo.apprIds,
                title: this.cucheckVo.apprTitle
              }
            }).then(v => {
              this.dialogFormVisible = false;
              this.dialogForm = false;
              this.init();
            }).catch(v => {
              alert("访问失败!" + v.data);
            })
          }
        }
      },
      deleteFalse(){//否决
        alert(this.empId);
        if(this.empId != undefined && this.empId != '') {
          this.$axios.get("http://localhost:8088/che/delete-check",
            {
              params: {
                empId: this.empId,
                apprId: this.cucheckVo.apprId,
                apprView: this.apprViews,
                trialId: this.cucheckVo.apprIds,
                title: this.cucheckVo.apprTitle
              }
            }
          ).then(v => {
            this.dialogFormVisible = false;
            this.init();
          }).catch(v => {
            alert("访问失败!" + v.data);
          })
        }
      },
      clear(){
        this.cucheckVo = {
          apprId: '',
          apprIds: '',
          apprTitle: '',
          apprReason: '',
          apprView: '',
          apprDate: '',
          apprComplete: '',
          apprDelete: '',
          cutId: '',
          approved: '',
          apply: '',
          cutName: ''
        };//审批表
        this.expenseVo = {
          expsId:'',
          expsRefus:'',
          expsDate:'',
          expsMoney:'',
          expsSort:'',
          expsNote:'',
          expsPurpose:'',
          expsRemark:'',
          expsTrip:'',
          expsNumber:'',
          expsGenre:'',
          expsRate:'',
          expsDelete:'',
          empId:'',
          approved:'',
          apply:'',
          cutName:'',
          customerByCustomId:{
            customId:'',
            cusName:''
          }
        };//销售费用表
        this.evection = {
          evetId:'',
          evetDate:'',
          evetData:'',
          evetEmpid:'',
          evetDepart:'',
          evetGoal:'',
          evetSubject:'',
          evetTraffic:'',
          evetRemark:'',
          evetState:'',
          evetLoan:'',
          evetStatus: '',
          evetDelete: '',
          customerByCustomId:{
            customId:'',
            cusName:''
          },
          empByEmployeesId:{
            employeesId:'',
            empName:''
          }
        };//出差表
        this.propleName = '';
        this.offerOne = {
          offer_id2:0,
          offerTitle:'',
          offerNumber:'',
          productOffer:'',
          paymentInstructions:'',
          transportInstructions:'',
          offerStatus:'',
          offerRemarks:'',
          profit:'',
          offerEmp:{
            empName:''
          },
          customerByCustomId:{
            cusName:''
          },
          businessInfoByBusinesId:{
            businessName:'',
            culinkmanByCupId:{
              cupName:''
            }
          }
        };//报价表
        this.title = '';//审批类型
        this.apprIds = '';    //需审批的id
        this.apprViews = '';     //审批意见
        this.employeesId = '';   //当前审批人
        this.dialogFormVisible = false;  //处理弹框
        this.dialogForm = false;
        this.disabledOne = false;
        this.disabledTwo = false;
        this.offerTwo = [];    //报价产品信息列表
        this.contractList = {};//合同信息
        this.zhaoContractInfo = {
          contractState:'',
          signingTime:'',
          contractTheme:'',
          businessName:'',
          contractName:'',
          effectTime:'',
          failureTime:'',
          totalAmount:'',
          customerName:'',
          empName:'',
          termsName:'',
          cusName:'',
          noteInfo:''
        };
        this.checkDetailsList = [];
        this.expsForm = false;
        this.evetForm = false;
        this.offerFrom = false;
        this.contractShow = false;
        this.deleteShow = false;
      }
    },
    filters: {
      formatDate(time){
        let date   = new Date(time);//把定义的时间赋值进来进行下面的转换
        let year   = date.getFullYear();
        let month  = date.getMonth()+1;
        let day    = date.getDate();
        let hour   = date.getHours();
        let minute = date.getMinutes();
        let second = date.getSeconds();
        return year+"-"+month+"-"+day;
        /*return year+"-"+month+"-"+day+" "+hour+":"+minute+":"+second;*/
      },
      formatDates(time){
        let date   = new Date(time);//把定义的时间赋值进来进行下面的转换
        let year   = date.getFullYear();
        let month  = date.getMonth()+1;
        let day    = date.getDate();
        let hour   = date.getHours();
        let minute = date.getMinutes();
        let second = date.getSeconds();
        return year+"-"+month+"-"+day+" "+hour+":"+minute+":"+second;
      },
      formatData(state) {
        if (state != null && state != "") {
          if(state == 1){
            return "执行中"
          }
          if(state == 2){
            return "结束"
          }
          if(state == 3){
            return "意外终止"
          }
        } else {
          return "";
        }
      },
      formatState(refus){
        if(refus != null && refus != ''){
          if(refus == 1){
            return "未报销"
          }
          if(refus == 2){
            return "已报销"
          }
        }
      }
    },
    watch:{
      $route(){//跳转到该页面后需要进行的操作
        this.clear();
        this.init();
      }
    }
  }
</script>

<style scoped>
  .back{
    border: 1px solid #F4F8FB;
    width: 100%;
    background: #F4F8FB;
  }
  .backs{
    border: 1px solid white;
    width: 97%;
    margin-bottom: 20px;
    background: white;
    margin-top: 20px;
    margin-left: 20px;
    font-size: 12px;
    font-weight: normal;
  }
  .hrst{
    width: 97%;
    border-top: 1px solid #aaaaaa;
    margin-left: 20px;
  }
  hr {
    margin-top: 10px;
    margin-bottom: 20px;
    border: 0;
  }
  .font{
    font-size: 18px;
    margin-top: 20px;
    margin-left: 20px;
  }
  .borders{
    border: 1px solid #F4F8FB;
    background-color: #F4F8FB;
    width: 100%;
  }
  .delete_height{
    height: 40px;
    font-size: 14px;
  }
  .border-t-a {
    border-top: 1px solid #aaaaaa;
    margin-top: -20px;
    margin-bottom: 30px;
  }
</style>
